class Solution(object):
    def readBinaryWatch(self, turnedOn):
        """
        :type turnedOn: int
        :rtype: List[str]
        """
        n = 10
        used = [0] * 10
        out = []

        def judge():
            h = used[0] * 8 + used[1] * 4 + used[2] * 2 + used[3] * 1
            min = used[4] * 32 + used[5] * 16 + used[6] * 8 + used[7] * 4 + used[8] * 2 + used[9] * 1
            if h < 12 and min < 60:
                h = str(h)
                min = str(min)
                if len(min) == 1:
                    out.append(h + ':' + '0' + min)
                else:
                    out.append(h + ':' + min)

        def search(i, k):
            if k == 0:
                judge()
            else:
                for j in range(i, n + 1 - k):
                    used[j] = 1
                    search(j + 1, k - 1)
                    used[j] = 0

        search(0, turnedOn)
        return out


data = Solution()
turnedOn = 1
print(data.readBinaryWatch(turnedOn))
